package com.evil.kingdom.controller.captcha;

import com.evil.common.core.entity.R;
import com.evil.kingdom.pojo.entity.captcha.Captcha;
import com.evil.kingdom.service.captcha.CaptchaService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 验证码接口
 *
 * @author liyang
 * @date 2024-06-02 19:17
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/captcha")
public class CaptchaController {

    private final CaptchaService captchaService;

    /**
     * 生成临时验证码
     *
     * @return R
     */
    @GetMapping("/random")
    public R<Captcha> random() {
        return R.success(captchaService.random());
    }
}
